package com.kust.smarthome.web.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.kust.smarthome.web.dto.EvaluateDto;
import com.kust.smarthome.web.model.Evaluate;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author iAuzre
 * @since 2021-07-12
 */
@Repository
public interface EvaluateMapper extends MPJBaseMapper<Evaluate> {

    /*id order_form_id commodity_id info imgurl1-4 created*/
    @Select("select e.id,e.order_form_id as orderFormId,e.info,e.imgurl1,e.imgurl2,e.imgurl3,e.imgurl4,e.created,u.username,u.portrait " +
            "from evaluate e " +
            "left join user u on u.id=e.user_id " +
            "where e.commodity_id=#{commodityId}")
    List<EvaluateDto> getEvaluateByCommodityId(Integer commodityId);
}
